************************************************************************************************
** REPLICATION DO-FILE FOR: SUNDSTRÖM & STOCKEMER (2022)
** "Measuring support for women's political leadership: Gender of interviewer effects among African survey respondents", Public Opinion Quarterly
*June 2022
*Code written in Stata/SE 17
************************************************************************************************

**** TABLE 1: Summary statistics for main variables ******

* Step 0: Launching Data for Table 1
use "merged_r6_data_2016_36countries.dta", clear

* Support for women leaders
tab Menbetterleaders
* Respondent and Interviewer gender
tabulate ordinal, generate(ordinal)
* Spouse, no one, and others present
tab spouseandotherspresent if spouseandotherspresent!=-1, generate(spouseandotherspresent)
* Age difference > 15
tab age_diff_binary15 if Q1!= -1 | Q1!= 998 | Q1!= 999
* Education
tabulate EDUC_COND if EDUC_COND!=9, generate(EDUC_COND)
* Religion
tabulate RELIG_COND if RELIG_COND!=9, generate(RELIG_COND)
* Urban vs. Rural
tabulate urban, generate(urban)

**** TABLE 2: Response distributions for the gendered leadership item by respondent and interviewer gender ******
use "merged_r6_data_2016_36countries.dta", clear

** distribution of DV (Menbetterleaders) for each of the ordinal-dyads
tab ordinal Menbetterleaders, row

** we now want to show that differences among men in each category is significant
** FOR MEN
tabulate Menbetterleaders Q114 if Q101==1, chi2 

** FOR WOMEN
tabulate Menbetterleaders Q114 if Q101==2, chi2 

*** TABLE 3: Multivariate ordinal logistic regression model of the gender of interviewer effects on gendered leadership item ******
use "merged_r6_data_2016_36countries.dta", clear

** Table 3, Model 1
ologit Menbetterleaders i.ordinal i.COUNTRY

** Table 3, Model 2
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if spouseandotherspresent ==-1
ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY

**Figure 1
margins, at(ordinal=(1,3))
marginsplot, legend(order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (a, replace) scheme(s1color) title("Male respondents") yscale(range(0 0.6)) ylabel(#7) xlabel(1 "Male" 3 "Female") xtitle("Gender of Interviewer")
margins, at(ordinal=(2,4))
marginsplot, legend(order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (b, replace) scheme(s1color) title("Female respondents") yscale(range(0 0.6)) ylabel(#7) xlabel(2 "Male" 4 "Female") xtitle("Gender of Interviewer")
grc1leg a b, legendfrom(a) ring(4) pos(6) scheme(s1color)
graph export Figure1.eps, replace
graph export Figure1.pdf, replace

** Table 3, Model 3
ologit Menbetterleaders i.ordinal##i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY 

**Figure 3
//install grc1leg2
margins, at(ordinal=(1,3) spouseandotherspresent=(0))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (a, replace) scheme(s1color) title("Male respondents," "no spouse", size (4)) yscale(range(0 0.6)) ylabel(#7)  xlabel(1 "Male" 3 "Female") xtitle("Gender of Interviewer")
margins, at(ordinal=(1,3) spouseandotherspresent=(1))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (b, replace)  scheme(s1color) title("Male respondents," "spouse present", size (4)) yscale(range(0 0.6)) ylabel(#7) xlabel(1 "Male" 3 "Female") ytitle("") xtitle("Gender of Interviewer") ytitle("")
margins, at(ordinal=(1,3) spouseandotherspresent=(2))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (c, replace) scheme(s1color) title("Male respondents," "others present", size (4)) yscale(range(0 0.6)) ylabel(#7) xlabel(1 "Male" 3 "Female") ytitle("") xtitle("Gender of Interviewer") ytitle("")
margins, at(ordinal=(2,4) spouseandotherspresent=(0))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (d, replace) scheme(s1color) title("Female respondents," "no spouse", size (4)) yscale(range(0 0.6)) ylabel(#7) xlabel(2 "Male" 4 "Female") xtitle("Gender of Interviewer")
margins, at(ordinal=(2,4) spouseandotherspresent=(1))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (e, replace) scheme(s1color) title("Female respondents," "spouse present", size (4)) yscale(range(0 0.6)) ylabel(#7) xlabel(2 "Male" 4  "Female")  ytitle("") xtitle("Gender of Interviewer") ytitle("")
margins, at(ordinal=(2,4) spouseandotherspresent=(2))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (f, replace) scheme(s1color) title("Female respondents," "others present", size (4)) yscale(range(0 0.6)) ylabel(#7) xlabel(2 "Male" 4 "Female")  ytitle("") xtitle("Gender of Interviewer") ytitle("")
grc1leg2 a b c d e f, legendfrom(a) ring(4) pos(6) scheme(s1color)  xsize(15) ysize(12)
graph export Figure3.eps, replace
graph export Figure3.pdf, replace

*** TABLE 4: Multivariate ordinal logistic regression model assessing whether the gendered interviewer effect is stronger for men or for women (ordered log odds regression coefficients, standard errors in parentheses) ************
use "merged_r6_data_2016_36countries.dta", clear 

** Table 4, Model 1
ologit Menbetterleaders Q114##Q101 i.COUNTRY

** Table 4, Model 2
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1
drop if spouseandotherspresent ==-1
ologit Menbetterleaders Q114##Q101 i.age_diff_binary15 i.spouseandotherspresent i.EDUC_COND i.RELIG_COND urban i.COUNTRY

**Figure 2
margins, dydx(Q114) at(Q101=(1 2))
marginsplot, yline(0) legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) xlabel(1 "Male" 2 "Female") title("") xtitle("Gender of Interviewer") scheme(s1color)
graph export Figure2.eps, replace
graph export Figure2.pdf, replace

*** TABLE 5: Multivariate ordinal logistic regression models of gender of interviewer effects on responses to the gendered leadership item: age difference interactions and education interactions ************
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1

** Table 5, Model 1
ologit Menbetterleaders i.ordinal i.spouseandotherspresent i.age_diff_binary15##i.ordinal i.EDUC_COND i.RELIG_COND urban i.COUNTRY

**Figure 4
margins, at(ordinal=(1,3) age_diff_binary15 =(0))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (a, replace) scheme(s1color) title("Male respondents," "age difference < 15 years", size (4)) yscale(range(0 0.6)) ylabel(#7) xtitle("Gender of Interviewer") xlabel(1 "Male" 3 "Female")
margins, at(ordinal=(1,3) age_diff_binary15=(1))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (b, replace) scheme(s1color) title("Male respondents," "age difference > 15 years", size (4)) yscale(range(0 0.6)) ylabel(#7) xtitle("Gender of Interviewer")  xlabel(1 "Male" 3 "Female") ytitle("")
margins, at(ordinal=(2,4) age_diff_binary15=(0))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (c, replace) scheme(s1color) title("Female respondents," "age difference < 15 years", size (4)) yscale(range(0 0.6)) ylabel(#7) xtitle("Gender of Interviewer") xlabel(2 "Male" 4 "Female")
margins, at(ordinal=(2,4) age_diff_binary15=(1))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (d, replace) scheme(s1color) title("Female respondents," "age difference > 15 years", size (4)) yscale(range(0 0.6)) ylabel(#7) xtitle("Gender of Interviewer") xlabel(2 "Male" 4 "Female") ytitle("")
grc1leg2 a b c d, legendfrom(a) ring(4) pos(6) scheme(s1color) xsize(15) ysize(12)
graph export Figure4.eps, replace
graph export Figure4.pdf, replace
*Final version of figure adjusted in Stata Graph Editor

** Table 5, Model 2
ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND##i.ordinal i.RELIG_COND urban i.COUNTRY

*Figure 5
margins, at(ordinal=(1 3) EDUC_COND= (0))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy)) plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (a, replace) scheme(s1color) title("Male respondents," "no formal education", size (4)) yscale(range(0 0.6)) ylabel(#4) xtitle("Gender of Interviewer") xlabel(1 "Male" 3 "Female")
margins, at(ordinal=(1 3) EDUC_COND= (1))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy))  plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (b, replace) scheme(s1color) title("Male respondents," "primary education", size (4)) yscale(range(0 0.6)) ylabel(#4) ytitle("") xtitle("Gender of Interviewer") xlabel(1 "Male" 3 "Female")
margins, at(ordinal=(1 3) EDUC_COND= (2))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy))  plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (c, replace) scheme(s1color) title("Male respondents," "secondary education", size (4)) yscale(range(0 0.6)) ylabel(#4) xtitle("Gender of Interviewer") xlabel(1 "Male" 3 "Female")
margins, at(ordinal=(1 3) EDUC_COND= (3)) 
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy))  plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (d, replace) scheme(s1color) title("Male respondents," "post-secondary education", size (4)) yscale(range(0 0.6)) ylabel(#4) ytitle("") xtitle("Gender of Interviewer") xlabel(1 "Male" 3 "Female")
grc1leg2 a b c d, legendfrom(a) ring(4) pos(6) scheme(s1color) xsize(15) ysize(12)
graph export Figure5.eps, replace
graph export Figure5.pdf, replace

qui: ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND##i.ordinal i.RELIG_COND urban i.COUNTRY

*Figure 6
margins, at(ordinal=(2 4) EDUC_COND= (0))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy))  plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (e, replace) scheme(s1color)  title("Female respondents," "no formal education", size (4)) yscale(range(0 0.6)) ylabel(#4) xlabel(2 "Male" 4 "Female") xtitle("Gender of Interviewer")
margins, at(ordinal=(2 4) EDUC_COND= (1))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy))  plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (f, replace) scheme(s1color) title("Female respondents," "primary education", size (4)) yscale(range(0 0.6)) ylabel(#4) xlabel(2 "Male" 4 "Female") ytitle("") xtitle("Gender of Interviewer")
margins, at(ordinal=(2 4) EDUC_COND= (2))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy))  plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (g, replace) scheme(s1color) title("Female respondents," "secondary education", size (4)) yscale(range(0 0.6)) ylabel(#4) xlabel(2 "Male" 4 "Female") xtitle("Gender of Interviewer")
margins, at(ordinal=(2 4) EDUC_COND= (3))
marginsplot, legend(size(medium) order(6 "strongly agree men better leaders" 7 "agree men better leaders" 8 "neutral" 9 "agree women for leaders" 10 "strongly agree women for leaders")) plot1opts(lcolor(dknavy) mcolor(dknavy)) plot2opts(lpattern(dot) lcolor(black) mcolor(black)) plot3opts(lpattern(shortdash) lcolor(dknavy) mcolor(dknavy))  plot4opts(lpattern(dot) lcolor(dknavy) mcolor(dknavy) lwidth(vthick)) plot5opts(lpattern(longdash) lcolor(dknavy) mcolor(dknavy)) ciopts(lcolor(dknavy)) name (h, replace) scheme(s1color) title("Female respondents," "post-secondary education", size (4)) yscale(range(0 0.6)) ylabel(#4) xlabel(2 "Male" 4 "Female") ytitle("") xtitle("Gender of Interviewer")
grc1leg2 e f g h, legendfrom(e) ring(4) pos(6) scheme(s1color) xsize(15) ysize(12)
graph export Figure6.eps, replace
graph export Figure6.pdf, replace

************************************************************************************************************************************************************************************************
****** SUPPLEMENTARY MATERIAL: TABLES IN APPENDIX
************************************************************************************************************************************************************************************************

*********** TABLE SM1 ************
** Model SM1a

use "merged_r5_data_AfroBarometer.dta", clear
ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY

** Model SM1b
use "merged_r7_data_34countries", clear
ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY


*********** TABLE SM3 ************
use "merged_r6_data_2016_36countries.dta", clear

capture program drop counter
program counter, rclass
syntax [varlist] [if] [in][, *]
codebook `varlist' `if' `in', `options'
capture ssc install distinct
foreach var of varlist `varlist' {
    qui distinct `var' `if' `in'
    return scalar nv_`var' = r(ndistinct)
}
end

foreach i of num 1/36 {
	preserve
  	keep if COUNTRY == `i'
	di "COUNTRY == `i' "
	di "Number of Male Interviewers"
	counter Q112 if Q114==1, compact
	di "Number of Feale Interviewers"
	counter Q112 if Q114==2, compact
	tab Q114
	drop if spouseandotherspresent ==-1
	tab spouseandotherspresent
	restore
 }

*********** TABLE SM4-7 ************
use "merged_r6_data_2016_36countries.dta", clear

** Table SM4
tabulate ordinal urban, row
tabulate ordinal urban, chi2

** Table SM5
preserve
drop if Q1== -1 | Q1== 998 | Q1== 999
tabstat Q1, by(ordinal)
anova Q1 ordinal 
restore
 
** Table SM6
preserve
drop if EDUC_COND==9
tabulate ordinal EDUC_COND, row
tabulate ordinal EDUC_COND, chi2 
restore

** Table SM7
preserve
drop if RELIG_COND==9
tabulate ordinal RELIG_COND, row
tabulate ordinal RELIG_COND, chi2
restore



*********** TABLE SM8 ************
use "merged_r6_data_2016_36countries.dta", clear
gen Menbetterleaders_DKs = .
replace Menbetterleaders_DKs = 0 if(Q18==1)
replace Menbetterleaders_DKs = 1 if(Q18==2)
replace Menbetterleaders_DKs = 2 if(Q18==5)
replace Menbetterleaders_DKs = 3 if(Q18==3)
replace Menbetterleaders_DKs = 4 if(Q18==4)
replace Menbetterleaders_DKs = 5 if(Q18==9)

foreach i of num 1/36 {
	preserve
  	keep if COUNTRY == `i'
	di "COUNTRY == `i' "
	tab Menbetterleaders_DKs
	restore
 }
 
 *********** TABLE SM9 ************
use "merged_r6_data_2016_36countries.dta", clear

foreach i of num 1/36 {
	preserve
  	keep if COUNTRY == `i'
	di "COUNTRY == `i' "
	tabulate ordinal, sum(Menbetterleaders)
	restore
 }

*********** TABLE SM10 ************
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if spouseandotherspresent ==-1

** Sm TABLE Sm10 5 year diff (Model Sm10a)
ologit Menbetterleaders i.ordinal##i.age_diff_binary5 i.spouseandotherspresent i.EDUC_COND i.RELIG_COND urban i.COUNTRY

** Sm TABLE Sm10 10 year diff (Model Sm10b)
ologit Menbetterleaders i.ordinal##i.age_diff_binary10 i.spouseandotherspresent i.EDUC_COND i.RELIG_COND urban i.COUNTRY

** Sm TABLE Sm10 20 year diff (Model Sm10c)
ologit Menbetterleaders i.ordinal##i.age_diff_binary20 i.spouseandotherspresent i.EDUC_COND i.RELIG_COND urban i.COUNTRY

*********** TABLES SM11, SM12 & SM13 ************

use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if spouseandotherspresent ==-1

** Sm TABLE Sm11
mlogit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY

** Sm TABLE Sm12
//install gologit2
gologit2 Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY

** Sm TABLE Sm13
gen Menbetterleaders_3cat = .
replace Menbetterleaders_3cat = 0 if(Q18==1 | Q18==2)
replace Menbetterleaders_3cat = 1 if(Q18==5)
replace Menbetterleaders_3cat = 2 if(Q18==3 | Q18==4)
ologit Menbetterleaders_3cat i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY 

*********** TABLE SM14 ************

** Model Sm14a: SAMPLE on MEN only
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1

keep if Q101==1
ologit Menbetterleaders Q114 i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY

** Model Sm14b: SAMPLE on WOMEN only
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1

keep if Q101==2
ologit Menbetterleaders Q114 i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY

*********** TABLE SM15 ************

** Model Sm15A - MEN only
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1

keep if Q101==1
ologit Menbetterleaders Q114##i.EDUC_COND i.spouseandotherspresent age_diff_binary15 i.RELIG_COND urban i.COUNTRY

** Model Sm15A - WOMEN only
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1

keep if Q101==2
ologit Menbetterleaders Q114##i.EDUC_COND i.spouseandotherspresent age_diff_binary15 i.RELIG_COND urban i.COUNTRY

*********** TABLE SM16 ************
use "merged_r6_data_2016_36countries.dta", clear

foreach i of num 1/36 {
	preserve
  	keep if COUNTRY == `i'
	di "COUNTRY == `i' "
	ologit Menbetterleaders i.ordinal Q1
	restore
 }

 *********** FIGURE SM1 ************
use "merged_r6_data_2016_36countries.dta", clear
 
foreach i of num 1/36 {
	di "COUNTRY == `i' "
	ologit Menbetterleaders i.ordinal i.COUNTRY if COUNTRY == `i'
	estimates store CI_`i'
 }

coefplot CI_1 CI_2 CI_3 CI_4 CI_5 CI_6 CI_7 CI_8 CI_9 CI_10 CI_11 CI_12 CI_13 CI_14 CI_15 CI_16 CI_17 CI_18 CI_19 CI_20 CI_21 CI_22 CI_23 CI_24 CI_25 CI_26 CI_27 CI_28 CI_29 CI_30 CI_31 CI_32 CI_33 CI_34 CI_35 CI_36, xline(0) legend(off)


 *********** TABLE SM17 ************
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1

** Model Sm17a: Region fixed effects
ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.REGION

** Model Sm17b: Local fixed effects
*NOTE: should run with "set scrollbufsize 2000000" and a Stata restart to visibly show model in output window
encode _v2, generate(_v22)
ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i._v22

*********** TABLE SM18 - CLUSTER STANDARD ERRORS ************
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1

** Model Sm18a: Std errors clustered on regions
ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY, cluster(REGION)

** Model Sm18b: Std errors clustered on local units
encode _v2, generate(_v22)
ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY, cluster(_v22)

** Model Sm18c: Std errors clustered on enumeration areas

*NOTE: replicating model Sm18c requires a geocoded version of Afrobarometer round 6, not shared to the public. It requires access permission from Afrobarometer/ Aiddata. As of June 2022, access is provided by following instructions in this link: https://www.afrobarometer.org/wp-content/uploads/2022/03/afrobarometer_application_for_restricted_data_w_geocodes_feb2020-1.pdf 

** Model Sm18d: Std errors clustered on interviewers
ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY, cluster(Q112)

 *********** TABLE SM19 ************
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1

drop if EA_SEC_C ==9
drop if EA_SVC_C ==9
drop if EA_FAC_D ==-1
drop if EA_FAC_D ==9

ologit Menbetterleaders i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban EA_SVC_C EA_FAC_D EA_SEC_C  i.COUNTRY

*********** TABLE SM20 ************
use "merged_r5_data_AfroBarometer.dta", clear

** Model SM20a
ologit Equal_divorce i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY

** Model SM20b
ologit Equal_work i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY

** Model SM20c
ologit Female_president i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY

*********** TABLE SM21: FALSIFICATION TEST ************
use "merged_r6_data_2016_36countries.dta", clear
drop if Q1== -1 | Q1== 998 | Q1== 999
drop if RELIG_COND==9
drop if EDUC_COND==9
drop if Q106 ==-1

** Model SM21a : `Country's economic condition
gen countr_econ = .
replace countr_econ = 1 if(Q6==1)
replace countr_econ = 2 if(Q6==2)
replace countr_econ = 3 if(Q6==3)
replace countr_econ = 4 if(Q6==4)
replace countr_econ = 5 if(Q6==5)
ologit countr_econ i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY 

** Model SM21b : Trust in president
gen trustpres = .
replace trustpres = 0 if(Q52A==0)
replace trustpres = 1 if(Q52A==1)
replace trustpres = 2 if(Q52A==2)
replace trustpres = 3 if(Q52A==3)
ologit trustpres i.ordinal i.spouseandotherspresent age_diff_binary15 i.EDUC_COND i.RELIG_COND urban i.COUNTRY
